Ext.namespace('iOS.View');

Ext.define('NormalIcon', {
	extend  : 'BaseIcon',
	
	statics : {
	    ViewCls     : 'nomal-icon',
	    IconCls     : 'ios-icon',
	    IconImg     : 'icon-img',
	    IconCover   : 'icon-cover',
	    IconText    : 'icon-text',
	    IconScreen  : 'icon-screen',
	    HomeButton  : 'home-button',
	    AppContent  : 'app-content',
	    ShakeLayer  : 'shake-layer',
	    ScaleLayer  : 'scale-layer',
	    OperaLayer  : 'opera-layer' 
	},
	
	/*
	 * 图标的位置，对应为配置文件里的index 
	 */
	_index : null,
	
	getInPos: function(index){
	    this._posIn = this.getPosByIndex(index);
	},

	getPosByIndex: function(index){
		var posX  = index % 4,
	        posY  = Math.floor(index / 4),
	        disX  = 17 * (posX + 1) + 58 * posX + 3 * Math.floor(posX.toString(2) / 10),
	        disY  = posY * 82 + (posY & 2) * 4 + 10;
	    return { x : disX, y : disY + 20 };
	},
	
	getOutPos : function(index){
	    var posY  = Math.floor(index / 4),
            posX  = index % 4,
            posIn = this._posIn,
            disX  = (posX & 2) - 1,
            disY  = (posY & 2) - 1;
	    this._posOut = {
	        x : this._posIn.x + 160 * disX,
	        y : this._posIn.y + 140 * disY
	    }
	}
});

iOS.View.NormalIcon = NormalIcon;
